/*
 * File      : usart.h

 *
 * Change Logs:

 */
#ifndef __LED_STATUS_H__
#define __LED_STATUS_H__
#include <rtthread.h>




#include "drivers/pin.h"
#define LED_SYS 58 //
#define LED_NET 71 //


#define CONNECTING     1
#define CONNECTED      2
#define CONNECT_ERROR  3

extern void set_net_led_flash(uint8_t mode);


 
#define SYS_NORMAL 1
#define SYS_ERROR  2
extern void set_sys_led_flash(uint8_t mode);


extern void led_flash_loop(void);

extern void sys_led_init(void);
extern void net_led_init(void);

struct LED
{
	uint16_t cur_state;
	const struct LED_flash * flash;
	void  (*led_on )(void);
	void  (*led_off)(void);
	uint16_t tick;
	uint16_t cyle_times;
	uint16_t cyle_count;
	struct LED * next;
};

void led_flash_loop();
void led_stop(struct LED* handle);
void led_flash_handler(struct LED * handle);
int led_start(struct LED* handle);
void led_attch(struct LED * handle,void * led_on_callback,void *led_off_callback);
void led_flash_set(struct LED * handle,const struct LED_flash *flash_mode,uint16_t cyle_times);
void set_net_led_flash(uint8_t mode);
void net_led_init(void);
void net_led_off(void);
void net_led_on(void);
void set_sys_led_flash(uint8_t mode);
void sys_led_init(void);
void sys_led_off(void);
void sys_led_on(void);
#endif
